// webhook列表
const webhookMap = {
  version: 1,
  mixin(key, name, url, { desc, group, config }) {
    webhookMap[key] = {
      type: "webhook",
      key,
      name,
      desc,
      url,
      group,
      config,
    };
  },
};

//白码基础
webhookMap.mixin("common", "白码基础webhook", "/api/libs/common/webhook.js", {
  desc: "白码基础webhook",
  group: "common",
  config: {},
});

//钉钉webhook
webhookMap.mixin("dingtalk", "钉钉API回调", "/api/libs/dingtalk/webhook.js", {
  desc: "功能说明:钉钉回调接口",
  group: "dingtalk",
  config: {
    corpid: {
      key: "corpid",
      value: "",
      description: "企业id",
      remark: "",
      required: true,
    },
    appkey: {
      key: "appkey",
      value: "",
      description: "应用 AppKey",
      remark: "",
      required: true,
    },
    appsecret: {
      key: "appsecret",
      value: "",
      description: "应用 AppSecret",
      remark: "",
      required: true,
    },
    aesKey: {
      key: "aesKey",
      value: "",
      description: "加密的AES KEY",
      remark: "",
      required: true,
    },
    token: {
      key: "token",
      value: "",
      description: "消息token",
      remark: "",
      required: true,
    },
  },
});

webhookMap.mixin(
  "weixinpay",
  "微信支付API回调",
  "/api/libs/weixinpay/webhook.js",
  {
    desc: "功能说明:微信支付API回调",
    group: "wechat",
    config: {
      appid: {
        key: "appid",
        value: "",
        description: "appid",
        remark: "",
        required: true,
      },
      mchid: {
        key: "mchid",
        value: "",
        description: "商户平台id",
        remark: "",
        required: true,
      },
      partnerKey: {
        key: "partnerKey",
        value: "",
        description: "微信商户平台API密钥",
        remark: "",
        required: true,
      },
      pfx: {
        key: "pfx",
        value: "",
        description: "微信商户平台证书",
        remark: "",
      },
    },
  }
);

export default webhookMap;
